package com.xiyu.service.dal.websocket.serverInit;

import com.xiyu.service.framework.websocket.core.listener.WebSocketMessageListener;
import com.xiyu.service.service.infra.devops.ServerService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.WebSocketSession;

@Component
public class ServerInitListener implements WebSocketMessageListener<Long> {

    final String socketType = "server-init";

    @Resource
    ServerService serverService;

    @Override
    public void onMessage(WebSocketSession session, Long serverId) {
        serverService.init(serverId);
    }

    @Override
    public String getType() {
        return socketType;
    }
}
